from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    kafka_bootstrap_servers: str = "172.17.76.135:9092"
    pdf_topic: str = "pdf_processing"
    dlq_topic: str = "pdf_processing_errors"
    consumer_group: str = "pdf_service_group"
    max_concurrent_processing: int = 5
    redis_host: str = "172.17.76.135"
    redis_port: int = 6379
    redis_db: int = 0
    retry_max_attempts: int = 3
    retry_wait_fixed: int = 5  # seconds
    conversion_timeout: int = 120  # seconds

    # Pydantic 2.x 新的配置方式
    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        # 可选：添加额外的配置
        extra="ignore",  # 忽略.env文件中多余的变量
        case_sensitive=False,  # 环境变量不区分大小写
    )

settings = Settings()